﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections;

namespace Gaiocorp.SLMapViewer.Legend
{
    public class LegendLayer
    {
        private LegendSymbols _Symbols=new LegendSymbols();
        private LayerFields _Fields = new LayerFields();
        public string Name { get; set; }
        public string Title { get; set; }
        public Int32 Index { get; set; }
        public bool Active { get; set; }
        public bool Visible { get; set; }
        public string IdField { get; set; }
        public string IdName { get; set; }
        public string XLinkField { get; set; }
        public bool IsAnnotation { get; set;}
        public bool EnableActive {get; set;}
        public string HLinkField { get; set; }
        public string HLinkParams { get; set; }
        public LayerFields Fields
        {
            get
            {
                return _Fields;
            }
            set
            {
                _Fields = value;
            }
        }
        public LegendSymbols Symbols 
        { 
            get 
            {
              return _Symbols  ;
            }
            set
            {
                _Symbols = value;
            }
        }
        
    }

    public class LegendLayers : System.Collections.Generic.List<LegendLayer>
    {
        public LegendLayer getLayerByName(string LayerName)
        {
            foreach (LegendLayer obj in this)
            {
                if (obj.Name == LayerName) return obj;
            }
            return null;
        }

        public LegendLayer getLayerByTitle(string LayerTitle)
        {
            foreach (LegendLayer obj in this)
            {
                if (obj.Title == LayerTitle) return obj;
            }
            return null;
        }
        public LegendLayer getActiveLayer()
        {
            foreach (LegendLayer obj in this)
            {
                if (obj.Active) return obj;
            }
            return null;
        }
    }
}
